package com.syher.springboot.activemq.app.produce;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Service;

import javax.jms.Destination;

@Service
public class Producer {

    @Autowired
    JmsTemplate template;

    public void convertAndSend(Destination destination, final String message) {
        template.convertAndSend(destination, message);
    }


    @JmsListener(destination = "reply")
    public void receiveQueue(String text) {
        System.out.println("Consumer receive reply message: " + text);
    }
}
